<%--
 *  File:   ClearSettingDetail.jsp
 *
 *  Date		  Author		 
 *  2010-07-26	  banshang		  
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
  //init param
  String privilegeCode = "E0531";
  String strTableName = "v_fileruleconfig";
  String strModuleName = "CFM";
	String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>

<html>
<head>
<title>ClearSettingDetail</title>
<PageFlow:CheckPageFlow pageName="p_processrulesmaintain"/>
<%@ include file="/inc/SumDiv.inc" %>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>

<script language="JavaScript">
<%--  put your custom script here   --%>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "ClearSettingSum.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
function clickRow(id,rule)
{
  var cform = document.cform;
  cform.datacleanprocessdetailid.value=id;
  cform.rule.value=rule;
}
function page_new()
{
	if(!checkForm(cform)) return ;
	document.cform.target = "_self";
	document.cform.actionname.value = "add"
	isRunning = true;
	document.cform.submit();
}
function page_delete()
{
	var cform = document.cform;
	var id = cform.datacleanprocessdetailid.value;
	if(isEmpty(id) || id == -1) return;
	if ( ! confirm("<%= message.getMessageDesc("ARE_YOU_SURE") %>") )  return;
	cform.actionname.value="delete";
	isRunning = true;
    cform.submit();
}

</script>
</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_processrulesmaintain">
    <input type="hidden" name="actionname">
    <custom:hidden property="datacleanprocessid" />
	<table width="100%">
		<tr>
			<td class="summary_top"></td>
		</tr>		
	</table>
    <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">
      <tr>
<%--  search criteria  --%>
      </tr>
          <tr class="deepblue-left" >
			  <td width="2%" class="title_center">&nbsp;</td>
	          <td class="title_center" width="8%"><%= label.getLabelName("L_Sequence") %>&nbsp;<span style="color:red"><%=label.getLabelName("L_Asterisk") %></span></td>
	          <td class="title_center" width="20%"><%= label.getLabelName("L_Rule") %>&nbsp;<span style="color:red"><%=label.getLabelName("L_Asterisk") %></span></td>
	          <td class="title_center" width="20%"><%= label.getLabelName("L_ErrorLevel") %>&nbsp;<span style="color:red"><%=label.getLabelName("L_Asterisk") %></span></td>
	          <td class="title_center" width="20%"><%= label.getLabelName("L_Parameter") %>&nbsp;</td>
	          <td class="title_center" width="*"><%= label.getLabelName("L_Comments") %>&nbsp;</td>
	        </tr>
	        <%
             int j = 0;
             String strClassType = new String(); 
             Integer nDefaultId = null;  
             boolean bHasChecked = false;
             Vector totalsummary = (Vector)pageContext.getAttribute("details");
             if(totalsummary == null) totalsummary = new Vector();
             Integer nDefaultRule = null;
	             
	        %>
	          <logic:iterate id="summary" collection="<%= totalsummary %>">                      
	         <%
	            HashMap summaryMap = (HashMap)pageContext.getAttribute("summary");
	            if(summaryMap == null) summaryMap = new HashMap();
	            String strIsChecked = new String("");
	            
	            if(j%2 == 1){
	              strClassType = "td-listrom";             
	            }else{                    
	              strClassType = "";
	            }
	            
	            Integer currentid = (Integer)summaryMap.get("datacleanprocessdetailid");
	            
	            if(!bHasChecked){
		              strIsChecked = "Checked";                       
		              bHasChecked = true;
		              nDefaultId = currentid;
		              nDefaultRule = (Integer)summaryMap.get("cleanrule");
		        }       
	            j++;     
	          %>
	          <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"  onClick="javascript:radiotrue('radio<%=JspHelper.filterNull(j)%>');clickRow('<custom:write property="datacleanprocessdetailid" name="summary"/>','<custom:write property="cleanrule" name="summary"/>')" class="<%=JspHelper.filterNull(strClassType)%>">
	            <td>
	              <input class="normalradio" id="radio<%=JspHelper.filterNull(j )%>" type="radio" name="radio" <%=JspHelper.filterNull( strIsChecked)%>>
	            </td>
	            <td>&nbsp;<custom:write property="sortno" name="summary" nbsp="true"/></td>
	            <td>&nbsp;<custom:write property="cleanrule" dictType="DataCleanRule" name="summary" nbsp="true"/></td>
	            <td>&nbsp;<custom:write property="errorlevel" name="summary" dictType="ErrorLevel" nbsp="true"/></td>
	            <td><custom:write property="filtername" name="summary" nbsp="true"/></td>
	            <td>&nbsp;<custom:write property="comments" name="summary" nbsp="true"/></td>
	          </tr>
	     	 </logic:iterate>
	     	 <input type="hidden" name="rule" value="<%=JspHelper.filterNull(nDefaultRule )%>"/>
	     	 <input type="hidden" name="datacleanprocessdetailid" value="<%=JspHelper.filterNull(nDefaultId )%>"/>
	     	 <tr>
	     	 	<td>&nbsp;</td>
	     	 	<td>
	     	 		<custom:text property="sortno" size="5" command="signlessinteger" label="L_Sequence"/>
	     	 	</td>
	     	 	<td>
	     	 		<custom:select optionInnerTextKey="cleanrulename" constant="10,20,30,40" optionsName="alldatacleanrule" property="cleanrule" optionValueKey="cleanrule" command="notnull" label="L_Rule" />
	     	 	</td>
	     	 	<td>
	     	 		<custom:selectdic dictType="ErrorLevel" property="errorlevel" valueCriteria="2,3,6"/>
	     	 	</td>
	     	 	<td>
	     	 		<custom:select optionInnerTextKey="filtername" optionsName="alldatacleanparam" property="conditionid" optionValueKey="advancedfilterid" defaultValue="---------" defaultValueCost=" "/>
	     	 	</td>
	     	 	<td>
	     	 		<custom:text property="comments" size="100"/>
	     	 	</td>
	     	 </tr>
	     	 
	      </table>
	      <table width="100%" cellspacing="0" cellpadding="0">
	        <tr> 
	          <td class="summary_top"></td>
	        </tr>
	        <tr>
			     <td class="td_center">
					<a onclick="page_new()"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
					<%
						if(totalsummary.size()!=0){
					%>
					<a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
					<%} %>
				 </td>
			</tr>
	      </table>
</form>
</body>
</html>